<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>商品设置</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/admin/css/style.css"/>
    <link rel="stylesheet" href="__STATIC__/admin/assets/css/ace.min.css"/>
    <link rel="stylesheet" href="__STATIC__/admin/assets/css/font-awesome.min.css"/>
    <link href="__STATIC__/admin/Widget/icheck/icheck.css" rel="stylesheet" type="text/css"/>
    <!--[if IE 7]>
    <link rel="stylesheet" href="__STATIC__/admin/assets/css/font-awesome-ie7.min.css"/>
    <![endif]-->
    <!--[if lte IE 8]>
    <link rel="stylesheet" href="__STATIC__/admin/assets/css/ace-ie.min.css"/>
    <![endif]-->
    <script src="__STATIC__/admin/js/jquery-1.9.1.min.js"></script>
    <script src="__STATIC__/admin/assets/js/bootstrap.min.js"></script>
    <script src="__STATIC__/admin/Widget/My97datePicker/WdatePicker.js"></script>
    <!--图片上传相关插件-->
    <link rel="stylesheet" href="__STATIC__/admin/bootstrap-fileinput-master/css/fileinput.css"/>
    <script src="__STATIC__/admin/bootstrap-fileinput-master/js/fileinput.js"></script>
    <script src="__STATIC__/admin/bootstrap-fileinput-master/js/locales/zh.js"></script>

    <style>
        select {
            margin-left: 10px;
            width: 100px;
        }

        textarea {
            width: 600px !important;
            height: 300px !important;
        }

    </style>
</head>

<body>
<div class="type_style container-fluid">
    <div class="crumbs">
        <ul>
            <li>
                <a href="index.html">商品管理</a>
            </li>
            <li class="uline">/</li>
            <li>
                <a class="active" href="javascript:;">上传相册</a>
            </li>
        </ul>
    </div>

    <input type="hidden" name="id" id="id" value="{$id|default=''}">

    <!--图片信息-->
    <div role="tabpanel" class="tab-pane" id="img">
        <input id="imgUpload" type="file" class="file-loading" multiple>
    </div>

</div>

<script type="text/javascript" src="__STATIC__/admin/Widget/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript">

</script>
</body>
</html>
<script>
    $('#imgUpload').fileinput({
        language: 'zh',
        uploadUrl: '{:url("product/uploadPhoto")}',
        autoReplace: true,
        uploadExtraData:function(){
            return {id:$('#id').val()}
        },
        maxFileCount: 10,
        allowedFileExtensions: ["jpg", "png", "gif"],
        dropZoneEnabled: false,//不显示拖拽区域
        showCaption: false,
        browseClass: "btn btn-primary", //按钮样式
        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>"
    });
    //检测上传成功
    $('#imgUpload').on('fileuploaded', function (e, data) {
        if (data.response.status > 0) {
            $('#image').val(data.response.path);
            $('#image_thumb').val(data.response.thumb);
            $('#img1').remove();
        } else {
            alert(data.response.err);
        }
    })


</script>
